
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="/dvmini/res/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/dvmini/res/css/Layuiglobal.css">
<style>
h4 {
	border-bottom: 1px solid #eee;
	line-height: 40px;
	padding-left: 20px;
}

.accredittrue,.accreditfalse {
	text-align: center;
	margin-top: 60px;
	display: none;
}

.wxblock {
	border: 1px solid #43c2af;
	border-radius: 10px;
	width: 680px;
	height: 380px;
}

.succbck {
	background: url(../../res/images/succ1.png) no-repeat center;
	-webkit-background-size: contain;
	background-size: contain;
}

.failbck {
	background: url(../../res/images/fail1.png) no-repeat center;
	-webkit-background-size: contain;
	background-size: contain;
}

.result {
	display: inline-block;
	margin-top: 70px;
}

.result i {
	width: 40px;
	height: 40px;
	float: left;
	margin-right: 10px;
	display: inline-block;
}

.result span {
	color: #0088CC;
	line-height: 40px;
	font-size: 20px;
	float: left;
	font-weight: bold;
}

.wxblock {
	overflow: hidden;
	border: 1px solid #ccc;
	text-align: center;
	margin: 40px auto;
}

h4 {
	line-height: 40px;
}

h4 i {
	font-size: 30px;
	margin-right: 10px;
}
</style>
</head>
<body>
	<h4>
		<i class="layui-icon">&#xe620;</i>微信号配置
	</h4>
	<section class="wxblock">
		<div class="accredittrue">
			<p class="result">
				<i class="succbck"></i><span>授权成功!</span>
			</p>
		</div>
		<div class="accreditfalse" style="display: none;">
			<p class="result">
				<i class="failbck"></i><span class="failtxt">授权失败!</span>
			</p>
		</div>
	</section>

</body>
<script src='/dvmini/res/js/jquery.min.js'></script>
<script type="text/javascript" src="/dvmini/res/js/jquery.qqFace.js"></script>
<script src="/dvmini/res/plugins/layui/layui.js" charset="utf-8"></script>
<script src="/dvmini/res/js/me.js"></script>
<script>
	layui.use([ 'layer', 'element' ], function() {
		var element = layui.element;
		var layer = layui.layer //初始化弹窗组件
		var timer;//声明一个定时器 
		var loadurl = window.location.href;
		console.log(loadurl);
		var arr = loadurl.split("auth_code=");
		var url = arr[1];
		console.log(url);
		var arr1 = url.split("&expires_in");
		console.log(arr1[0], arr1[1]);
		var auth_code = arr1[0];
		console.log(auth_code);

		function publik() {
			$.post("../wx/getAuthAuthorization", {
				auth_code : auth_code,
				merchantId: 1
			}, function(data) {
				console.log(data);
				if (data.code == 0) {
					$(".accredittrue").show();
					$(".accreditfalse").hide();
				} else {
					$(".accreditfalse").hide();
					$(".failtxt").html(data.msg);
					$(".accredittrue").show();
				}
			})
		}
		
		publik();

	})
</script>
</html>
